<!--_meta 作为公共模版分离出去-->
<#include "include/_meta.html">

<head>
	<title>更新自用记录</title>
	<meta name="keywords" content="汽车租赁">

	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
	<script src="vue/vue.min.js"></script>
</head>
<body>
<article class="page-container">

	<form class="form form-horizontal" id="form-safeUse-edit" >

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>车牌号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.carIdCard)}" placeholder="车牌号" id="carIdCard" name="carIdCard">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>发车里程：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.initMile?c)!}" placeholder="发车里程" id="initMile" name="initMile">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>发车油量：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.initOil)}" placeholder="发车油量" id="initOil" name="initOil">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>使用事项：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.noticeItem)}" placeholder="使用事项" id="noticeItem" name="noticeItem">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>发车时间：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.safeUseStart)}" placeholder="发车时间" id="safeUseStart" name="safeUseStart">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>预计还车时间：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.predTime)}" placeholder="预计还车时间" id="predTime" name="predTime">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>经办人：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.user.userId)}" placeholder="经办人"  id="userId" name="userId">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>经办人手机：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.mobile)}" placeholder="经办人手机" id="mobile" name="mobile">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>还车时间：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.safeUseEnd)}" placeholder="还车时间" id="safeUseEnd" name="safeUseEnd">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>还车里程：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.returnMile?c)!}" placeholder="还车里程" id="returnMile" name="returnMile">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>还车油量：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${(safeUse.returnOil)}" placeholder="还车油量" id="returnOil" name="returnOil">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">*备注：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea id="remark" name="remark" cols="" rows="" class="textarea"  placeholder="说点什么...100个字符以内" dragonfly="true" ></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
			</div>
		</div>

		<div hidden="hidden" class="row cl">
			<label class="form-label col-xs-4 col-sm-3">ID：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" autocomplete="off" placeholder="ID"
					   value="${(safeUse.safeUseId)}" id="safeUseId" name="safeUseId">
			</div>
		</div>

		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input onclick="submitaaa()" class="btn btn-primary radius" type="button" value="提交"/>
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->


<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">

	var t1 = "${(safeUse.remark)}";
	$("#remark").val(t1);



	var closec = function () {
		var thisName = parent.layer.getFrameIndex(window.name);
		parent.layer.close(thisName);
	}

	var submitaaa = function () {
		let mustData = ['carIdCard', 'initMile', 'initOil', 'noticeItem', 'safeUseStart','predTime','userId', 'mobile',  'safeUseEnd',
			'returnMile','returnOil','remark'];
		let mustDataTip = ['车牌号不能为空', '发车里程不能为空', '发车油量不能为空', '使用事项不能为空','发车时间不能为空','预计还车时间不能为空', '经办人不能为空',
			'经办人手机不能为空', '还车时间不能为空',  '还车里程不能为空','还车油量不能为空','备注内容不能为空'];
		let canSet = true;

		for (let i = 0; i < mustData.length; i++) {
			if ($("#" + mustData[i]).val() == '') {
				layer.msg("必填:" + mustDataTip[i], {icon: 5});
				canSet = false;
				break;
			}
		};
		if (canSet) {
			$.ajax({
				type: "POST",
				url: "/editSafeUse",
				data: $("#form-safeUse-edit").serialize(),
				dataType: "json",
				success: function (result) {
					if (result.flag == 1) {
						layer.msg(result.flag + ":" + result.msg, {icon: 6});
					} else {
						layer.msg(result.flag + ":" + result.msg, {icon: 5});
					}
					closec();
				}
			});
		}
	}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>